﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;

using MongoDB.Bson;
using MongoDB.Driver;
using MongoDB.Driver.Builders;
using MongoDB.Driver.GridFS;
using MongoDB.Driver.Linq;

namespace ConsoleApp1
{
    using HtmlAgilityPack;
    class Program
    {

        static void Main()
        {
            /*
            var url = @"http://www.gxzfcg.gov.cn/CmsNewsController/getCmsNewsList/channelCode-shengji_qtgg/param_bulletin/20/page_1.html";
            HtmlWeb web = new HtmlWeb();
            var doc= web.Load(url);
            
            HtmlNode titleNode = doc.DocumentNode.SelectSingleNode("//div[@id='channelBody']/div[2]/ul/li/a");
            Console.Write(titleNode != null ? titleNode.Attributes["href"].Value: "节点为空");
            Console.ReadLine();
            */

            /*MongoDB测试程序段*/
            /*
            var connectionString = "mongodb://usr:psw@192.168.6.65:27017";
            var client = new MongoClient(connectionString);
            var server = client.GetServer();
            var database = server.GetDatabase("news"); // "test" is the name of the database

            var collection = database.GetCollection<TDocument>("collectionname");

            var query =
    from e in collection.AsQueryable<Employee>()
    where e.FirstName == "John"
    select e;

            foreach (var employee in query)
            {
                // process employees named "John"
            }

            //*/


            /*MailKit测试程序段*/
            /*
            var connectionString = "mongodb://usr:psw@192.168.6.65:27017";
            var client = new MongoClient(connectionString);
            var server = client.GetServer();
            var database = server.GetDatabase("news"); // "test" is the name of the database

            var collection = database.GetCollection<TDocument>("collectionname");

            var query =
    from e in collection.AsQueryable<Employee>()
    where e.FirstName == "John"
    select e;

            foreach (var employee in query)
            {
                // process employees named "John"
            }

            //*/
        }

    }
}
